using System;
using System.Collections.Generic;

namespace UnityEngine.Recorder.Input
{
	public class Camera360InputSettings : ImageInputSettings
	{
		public EImageSource source = EImageSource.MainCamera;

		public string m_CameraTag;

		public bool m_FlipFinalOutput;

		public bool m_RenderStereo = true;

		public float m_StereoSeparation = 0.065f;

		public int m_MapSize = 1024;

		public int m_OutputWidth = 1024;

		public int m_OutputHeight = 2048;

		public override Type inputType => typeof(Camera360Input);

		public override bool ValidityCheck(List<string> errors)
		{
			bool result = base.ValidityCheck(errors);
			if (source == EImageSource.TaggedCamera && string.IsNullOrEmpty(m_CameraTag))
			{
				result = false;
				errors.Add("Missing camera tag");
			}
			if (m_OutputWidth != 1 << (int)Math.Log(m_OutputWidth, 2.0))
			{
				result = false;
				errors.Add("Output width must be a power of 2.");
			}
			if (m_OutputWidth < 128 || m_OutputWidth > 8192)
			{
				result = false;
				errors.Add($"Output width must fall between {128} and {8192}.");
			}
			if (m_OutputHeight != 1 << (int)Math.Log(m_OutputHeight, 2.0))
			{
				result = false;
				errors.Add("Output height must be a power of 2.");
			}
			if (m_OutputHeight < 128 || m_OutputHeight > 8192)
			{
				result = false;
				errors.Add($"Output height must fall between {128} and {8192}.");
			}
			if (m_MapSize != 1 << (int)Math.Log(m_MapSize, 2.0))
			{
				result = false;
				errors.Add("Cube Map size must be a power of 2.");
			}
			if (m_MapSize < 16 || m_MapSize > 8192)
			{
				result = false;
				errors.Add($"Cube Map size must fall between {16} and {8192}.");
			}
			if (m_RenderStereo && m_StereoSeparation < float.Epsilon)
			{
				result = false;
				errors.Add("Stereo separation value is too small.");
			}
			return result;
		}
	}
}
